package main

import "fmt"

/**
 * @author: guangcheng
 * @date:   2020/11/15 15:01
 * @version  V1.0
 * @description:
 *
 */
func main() {

	var str1 string = "hello@guigu"
	slice := str1[6:]
	fmt.Println(slice) //guigu

	arr1 := []byte(str1)
	arr1[0] = 'g'
	for i := range arr1 {
		fmt.Printf("%c", arr1[i])
	}

	fmt.Println("\n=======")
	str1 = string(arr1)
	fmt.Println(str1)

	//[]rune可以处理中文: rune按照字符进行处理
	arr2 := []rune(str1)
	arr2[0] = '上'
	for i := range arr2 {
		fmt.Println(arr2[i])
	}
	str1 = string(arr2)
	fmt.Println(str1)

}
